// binary_negate example
#include <algorithm>  // std::mismatch
#include <functional> // std::binary_negate, std::equal_to
#include <iostream>   // std::cout
#include <utility>    // std::pair

int main() {
  std::equal_to<int> equality;
  std::binary_negate<std::equal_to<int>> nonequality(equality);
  int foo[] = {10, 20, 30, 40, 50};
  int bar[] = {0, 15, 30, 45, 60};
  std::pair<int *, int *> firstmatch, firstmismatch;
  firstmismatch = std::mismatch(foo, foo + 5, bar, equality);
  firstmatch = std::mismatch(foo, foo + 5, bar, nonequality);
  std::cout << "第一个不匹配元素 foo =  " << *firstmismatch.first
            << " bar = " << *firstmismatch.second << "\n";
  std::cout << "第一个匹配元素 foo = " << *firstmatch.first
            << " bar = " << *firstmatch.second << "\n";
  return 0;
}
